home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
util
/
rexx
/
rmh.lha
/
rmh
/
examples
/
notify.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-04-23
|
1KB
|
50 lines
/*
Name: notify.rexx
Template: FILE,CLIP=CLIPUNIT/K/N,TIMEOUT/K/N
Description: wait for a changes on a FILE or a CLIP with timeout
default for CLIP is 0
default for TIMEOUT is 10 seconds
*/
parm.1.value=0
parm.2.value=10
if ~RMH_ReadArgs("FILE,CLIP=CLIPUNIT/K/N,TIMEOUT/K/N") then do
call PrintFault(IoErr(),ProgramName("NOEXT"))
exit
end
if parm.1.value<0 | parm.2.value<0 | parm.2.value>100 then do
call PrintFault(115,ProgramName("NOEXT"))
exit
end
if ~parm.0.flag | parm.1.flag then name="CLIP"
else name=parm.0.value
if name=="CLIP" then noti=StartNotify(name,parm.1.value)
else noti=StartNotify(name)
if noti<0 then do
call PrintFault(IoErr(),ProgramName("NOEXT"))
exit
end
ns=NotifySignal(noti)
timer=CreateTimer()
ts=TimerSignal(timer)
call StartTimer(timer,parm.2.value)
mask=wait(or(ns,ts))
if and(mask,ns)~=0 then do
if name=="CLIP" then do
say "Clip unit" parm.1.value "changed"
if ReadTextClip("C")~=0 then do
say "Clip unit" parm.1.value "content is:"
say c
end
end
else say "File:" name "changed"
end
else if and(mask,ts)~=0 then say "Timeout"
call FreeNotify(noti)